<script  setup lang="ts">
import { ref } from 'vue'
import { Search, RefreshRight, Plus, Document, Setting } from '@element-plus/icons-vue'
let input1 = ref<string>('')
let input2 = ref<string>('')

// table
const tableData = [
{
        date: '2016-05-03',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-03',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-03',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-03',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Home',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        state: 'California',
        city: 'Los Angeles',
        address: 'No. 189, Grove St, Los Angeles',
        zip: 'CA 90036',
        tag: 'Office',
    },
]

const handleClick = () => {
  console.log('click')
}

// 分页
const currentPage2 = ref(5)
const pageSize2 = ref(100)
const small = ref(true)
const background = ref(false)
const disabled = ref(false)

const handleSizeChange = (val: number) => {
    console.log(`${val} items per page`)
}
const handleCurrentChange = (val: number) => {
    console.log(`current page: ${val}`)
}

</script>
<template>
    <div class="wrapper">
        <div class="title_line">
            <div>
                <span class="title_line_big">
                    表格页
                </span>
                <span class="title_line_small">
                    小标题
                </span>
            </div>
            <div>
                <el-link class="title_line_back">返回</el-link>
            </div>
        </div>
        <div class="filter_line">
            <div class="filter_line_left">
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号1
                    </span>
                    <span>
                        <el-input v-model="input1" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号2
                    </span>
                    <span>
                        <el-input v-model="input2" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号1
                    </span>
                    <span>
                        <el-input v-model="input1" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号2
                    </span>
                    <span>
                        <el-input v-model="input2" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号1
                    </span>
                    <span>
                        <el-input v-model="input1" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号2
                    </span>
                    <span>
                        <el-input v-model="input2" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号2
                    </span>
                    <span>
                        <el-input v-model="input2" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号2
                    </span>
                    <span>
                        <el-input v-model="input2" placeholder=""></el-input>
                    </span>
                </div>
                <div class="filter_item">
                    <span class="filter_title">
                        集合编号2
                    </span>
                    <span>
                        <el-input v-model="input2" placeholder=""></el-input>
                    </span>
                </div>
                
            </div>
            <div class="filter_line_right">
                <div class="filter_line_right_item">
                    <el-button :icon="Search" type="primary">查询</el-button>
                </div>
                <div class="filter_line_right_item">
                    <el-button :icon="RefreshRight">重置</el-button>
                </div>
            </div>
        </div>
        <div class="btn_group">
            <div class="btn_group_item">
                <el-button :icon="Plus" type="primary">添加</el-button>
            </div>
            <div class="btn_group_item">
                <el-button :icon="Document">导出</el-button>
                <el-button :icon="Setting" type="primary">配置</el-button>
            </div>
        </div>
        <div class="table">
            <el-table :data="tableData" style="width: 100%">
                <el-table-column fixed prop="date" :label="$t('page2_4_1.date')" width="150" />
                <el-table-column prop="name" :label="$t('page2_4_1.name')" width="120" />
                <el-table-column prop="state" :label="$t('page2_4_1.state')" width="120" />
                <el-table-column prop="city" :label="$t('page2_4_1.city')" width="120" />
                <el-table-column prop="address" :label="$t('page2_4_1.address')" width="600" />
                <el-table-column prop="zip" label="Zip"/>
                <el-table-column fixed="right" :label="$t('page2_4_1.operations')" width="120">
                    <template #default>
                        <el-button link type="primary" size="small" @click="handleClick">{{ $t('page2_4_1.detail') }}</el-button>
                        <el-button link type="primary" size="small">{{ $t('page2_4_1.edit') }}</el-button>
                    </template>
                </el-table-column>
            </el-table>
        </div>
        <el-affix position="bottom" :offset="0">
            <div class="pagination-block">
                <el-pagination v-model:currentPage="currentPage2" v-model:page-size="pageSize2"
                    :page-sizes="[100, 200, 300, 400]" :small="small" :disabled="disabled" :background="background"
                    layout="sizes, prev, pager, next" :total="1000" @size-change="handleSizeChange"
                    @current-change="handleCurrentChange" />
                </div>
        </el-affix>
    </div>
</template>

<style lang="scss" scoped>
.wrapper {
    background-color: white;
    box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.title_line {
    display: flex;
    justify-content: space-between;

    &_big {
        font-size: 18px;
    }

    &_small {
        font-size: 12px;
    }

    &_back {
        font-size: 14px;
    }
}

.filter_line {
    display: flex;
    margin-top: 15px;
    border-bottom: 1px solid rgb(229, 230, 235);

    &_left {
        flex: 1
    }

    &_right {
        width: 82px;
        margin-left: 20px;

        &_item {
            margin-bottom: 10px;
        }
    }
}

.filter_line_left {
    display: flex;
    flex-wrap: wrap;
}

.filter_item {
    display: flex;
    align-items: center;
    height: 40px;
    padding-right: 20px;
}

.filter_title {
    margin-right: 10px;
}

.btn_group {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
}

.table {
    flex: 1;
}

.pagination-block {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    background-color: white;
    height: 40px;
}
.el-affix .pagination-block{
    height: auto !important;
}
</style>
<script lang="ts">
export default {
    name: 'page2_4_1'
}
</script>